package org.chinarjy.service;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.chinarjy.api.MyApi;
import org.chinarjy.dto.ResultApi;
import org.chinarjy.entity.Person;
import org.chinarjy.mapper.PersonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@DubboService
@Component
public class MyService implements MyApi {
    @Autowired
    PersonMapper personMapper;
    @Override
    public ResultApi<List<Person>> getAllPersons() {
        log.info("DubboService -->> getAllPersons");
        List<Person> persons = personMapper.selectList(null);
        return ResultApi.success(persons);
    }

    @Override
    public ResultApi<Person> addPerson(Person person) {
        return null;
    }

    @Override
    public ResultApi<Person> removePerson(Person person) {
        return null;
    }

    @Override
    public ResultApi<Person> updatePerson(Person person) {
        return null;
    }
}
